#ifndef _TaskQueue_H_
#define _TaskQueue_H_

#include "Condition.hpp"
#include "MutexLock.hpp"
#include <queue>
#include <functional>
using std::queue;


namespace wd{


class MutexLock;
class Condition;
using ElemType = std::function<void()>;

class TaskQueue{
friend class ThreadPool;

public:
    TaskQueue(int);
    ~TaskQueue();

    bool empty();
    bool full();
    void push(ElemType && );
    ElemType pop();
private:
    void wakeup();

private:
    queue<ElemType> _que;
    int _queSize;
    MutexLock _mutex;
    Condition _notFull;
    Condition _notEmpty;
    bool _flag;
};

}

#endif

